PoD: Allocate 4k pages if 2 meg allocation fails
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Sep 2009 09:47:36 +0000 (10:47 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Sep 2009 09:47:36 +0000 (10:47 +0100)
In p2m_pod_set_cache_target:
 * If a 2-meg allocation fails, try a 4k allocation
 * If both allocations fail, return -ENOMEM so that the domain build
   will fail.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/mm/p2m.c

index 7fba54e0a2fe86d0e5f064f3212439a6d713352c..dfbd3fa781e570640d514c22ee4ac8744e1b411c 100644 (file)
@@ -386,10 +386,22 @@ p2m_pod_set_cache_target(struct domain *d, unsigned long pod_target)
             order = 9;
         else
             order = 0;
-
+    retry:
         page = alloc_domheap_pages(d, order, 0);
         if ( unlikely(page == NULL) )
+        {
+            if ( order == 9 )
+            {
+                /* If we can't allocate a superpage, try singleton pages */
+                order = 0;
+                goto retry;
+            }   
+            
+            printk("%s: Unable to allocate domheap page for pod cache.  target %lu cachesize %d\n",
+                   __func__, pod_target, p2md->pod.count);
+            ret = -ENOMEM;
             goto out;
+        }
 
         p2m_pod_cache_add(d, page, order);
     }